<?php

namespace Part01_SimpleFactoryMode\Code4;

use Exception;

/**
 * @desc: 除法运算类
 * @date: 2021/9/9
 */
class OperationDiv extends Operation
{
    /**
     * @throws \Exception
     */
    public function getResult()
    {
        $numB = $this->getNumB();
        if ($numB == 0) {
            throw new Exception('除数不能为0');
        }
        return $this->getNumA() / $this->getNumB();
    }
}